Because the Date conversion format in JS does not have a "-" delimiter, Date.parse generates Nan, so it can only be converted.Methods of extendingDate.prototype.Format = function (FMT) {//author:meizz var o = {"m+": This.getmonth () + 1,
Date. parse (dateVal)This method is very common. For example, you can use it to verify whether the input date exists. If it is a non-existent date, the return value will be NaN, in addition, it can be used to compare the order of two dates or
This method is very common. For example, you can use it to verify whether the input date exists. If it is a non-existent date, the return value will be NaN, in addition, it can be used to compare the order of two dates or calculate the number of
Copy codeThe Code is as follows:$ (Function (){Var mydate = new Date ();Var t = mydate. toLocaleString ();/* Alert (t );*/$ ("# Time"). text (t );$ ("# Time"). load ("Untitled-1.html ");}); afwef Use the built-in Date function to get the JavaScript
The methods for getting time and frequently used time classes are frequently used by everyone. I have sorted out some of them in this article. I personally feel that they are still quite complete. Interested friends can collect them.
The Code is as
JS to obtain the current date and time and other operations 2008-07-28-06-11 17: 24var mydate = new date ();Mydate. getyear (); // obtain the current year (2 digits)Mydate. getfullyear (); // obtain the complete year (4 bits, 1970 -????)Mydate.
Time Processing in javascript and javascript Time ProcessingVar myDate = new Date ();MyDate. getYear (); // obtain the current year (2 digits)MyDate. getFullYear (); // obtain the complete year (4 bits, 1970 -????)MyDate. getMonth (); // obtain the
Date and Time script library method list Date. prototype. isLeapYear judge leap year
Date. prototype. Format
Date. prototype. DateAdd Date calculation
Date. prototype. DateDiff compare Date difference
Date. prototype. toString Date to string
Date.
VaR mydate = new date ();Mydate. getyear (); // obtain the current year (2 digits)Mydate. getfullyear (); // obtain the complete year (4 bits, 1970 -????)Mydate. getmonth (); // obtain the current month (0-11, 0 represents January)Mydate. getdate (
[To] http://www.cnblogs.com/xiangdingdingVictory/archive/2010/12/30/1922364.html
Jquery date calculation
VarmyDate = new Date ();MyDate. getYear (); // obtain the current year (2 digits)MyDate. getFullYear (); // obtain the complete year (4 bits, 19
Js get current date
Js to obtain the current Date and time and other operations 2008-07-28-06-11 17: 24var myDate = new Date ();MyDate. getYear (); // obtain the current year (2 digits)MyDate. getFullYear (); // obtain the complete year (4
Copy codeThe Code is as follows :/**
2 * retrieve array elements (prototype extension or overload)
3 * @ param {o} The retrieved element value
4 * @ type int
5 * @ returns element index
6 */
7 Array. prototype. contains = function (o ){
8 var index =
MyDate. getYear (); // obtain the current year (2 digits)
MyDate. getFullYear (); // obtain the complete year (4 bits, 1970 -????)
MyDate. getMonth (); // obtain the current month (0-11, 0 represents January)
MyDate. getDate (); // obtain the
Js obtains the current date and time and other operationsVar myDate = new Date ();MyDate. getYear (); // obtain the current year (2 digits)MyDate. getFullYear (); // obtain the complete year (4 bits, 1970 -????)MyDate. getMonth (); // obtain the
Use this method
long time = Date.parse("Sun Feb 26 10:31:58 +0800 2012"); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); Date d = new Date(time); System.out.println(sdf.format(d));
Us time format
// G era flag text ad//
Js method for obtaining time functions and extended functions built-in Date functions
Var mydate = new Date ();Mydate. getYear (); // obtain the current year (2 digits)Mydate. getFullYear (); // obtain the complete year (4 bits, 1970 -????)Mydate.
This article mainly introduces how to get the summary of current date and time and other date operations by js. Interested partners can refer to the examples in this article to share common scenarios of javascript time operations, for your reference,
Js obtains the summary of current date and time and other date operations.
The examples in this article share common scenarios of javascript time operations for your reference. The specific content is as follows:
Var myDate = new Date (); myDate.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.